/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights
 * reserved. <a>http://www.cqcis.com</a>
 */
package com.firebird.base.utils;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
/**
 * @author qiuxj
 * @date 2009-11-14
 */
public class GenericsUtils {
	
	  public static Class<?> getGenericClass(Class<?> clazz)
	  {
	    Type genType = clazz.getGenericSuperclass();

	    if (genType instanceof ParameterizedType) {
	      Type[] params = ((ParameterizedType)genType)
	        .getActualTypeArguments();

	      if ((params != null) && (params.length == 1)) {
	        return ((Class)params[0]);
	      }
	    }

	    return null;
	  }

}
